﻿/* Commenting out in 3.5 version
namespace IntegrationTests.ExpandoObjectTests
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using DirectoryServicesProtocolsExtensions.LdapConnection;
    using DirectoryServicesProtocolsExtensions.SearchRequest;
    using DirectoryServicesProtocolsExtensions.SearchResult;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using System.Linq;

    [TestClass]
    public class ToExpandoTests : LdapTest
    {
        [TestMethod]
        public void ToExpandoUserObjectTest()
        {
            var ldapQueryPropertiesContainer = new MockFabrikamActiveDirectoryQueryPropertiesContainer
            {
                  SearchBaseDN = "CN=Administrator,CN=Users,DC=fabrikam,DC=com",
                  AttributesToLoad = new[] { "distinguishedName", "createTimeStamp", "lastLogonTimestamp" }
            };
            var pagedSearchRequest = new PagedSearchRequest(ldapQueryPropertiesContainer);
            var expando = pagedSearchRequest.Execute(LDAPConnection)
                .Single()[0]
                .ToExpandoObject(LDAPConnection);
            Assert.IsTrue(expando.distinguishedName == ldapQueryPropertiesContainer.SearchBaseDN);
            Assert.IsTrue(expando.createTimeStamp is DateTime);
            Assert.IsTrue(expando.lastLogonTimestamp is DateTime);
            Debug.WriteLine((DateTime)expando.createTimeStamp);
            Debug.WriteLine((DateTime)expando.lastLogonTimestamp);
        }

        [TestMethod]
        public void ToExpandoGroupObjectTestWithMemberExpansion()
        {
            var ldapQueryPropertiesContainer = new MockFabrikamActiveDirectoryQueryPropertiesContainer
            {
                SearchBaseDN = "CN=groupWith1501Member,OU=test1001,DC=fabrikam,DC=com",
                AttributesToLoad = new[] { "distinguishedName", "createTimeStamp", "member" }
            };
            var pagedSearchRequest = new PagedSearchRequest(ldapQueryPropertiesContainer);
            var expando = pagedSearchRequest.Execute(LDAPConnection)
                .Single()[0]
                .ToExpandoObject(LDAPConnection);
            Assert.IsTrue(expando.distinguishedName == ldapQueryPropertiesContainer.SearchBaseDN);
            Assert.IsTrue(expando.createTimeStamp is DateTime);
            Assert.IsTrue(expando.member is List<string>);
            var members = (List<string>)expando.member;
            Assert.IsTrue(members.Count > 1500);
        }

        [TestMethod]
        public void ToExpandoGroupObjectTestWithoutMemberExpansion()
        {
            var ldapConnectionPropertiesContainer = new MockFabrikamActiveDirectoryConnectionPropertiesContainer();
            var ldapConnectionFactory = new LdapConnectionFactory(ldapConnectionPropertiesContainer);
            var ldapConnection = ldapConnectionFactory.Create();
            
            var ldapQueryPropertiesContainer = new MockFabrikamActiveDirectoryQueryPropertiesContainer
            {
                SearchBaseDN = "CN=GroupWith501Members,OU=test501,DC=fabrikam,DC=com",
                AttributesToLoad = new[] { "distinguishedName", "createTimeStamp", "member" }
            };
            var pagedSearchRequest = new PagedSearchRequest(ldapQueryPropertiesContainer);
            var expando = pagedSearchRequest.Execute(LDAPConnection)
                .Single()[0]
                .ToExpandoObject(ldapConnection);
            Assert.IsTrue(expando.distinguishedName == ldapQueryPropertiesContainer.SearchBaseDN);
            Assert.IsTrue(expando.createTimeStamp is DateTime);
            Assert.IsTrue(expando.member is List<string>);
            var members = (List<string>)expando.member;
            Assert.IsTrue(members.Count > 500);
        }
    }
}
*/